<!DOCTYPE html>
<html>
<head>
    <title>grid组件</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <script src="../../avalon.js"></script>
    <script>
        //newgrid用
        var cols = [
            {name: 'id', display: '编号', width: "100%", type: 'text', disabled: false},
            {name: 'name', display: '名称', width: 150, type: 'text', disabled: true},
            {name: 'price', display: '价格', width: 120, type: 'text', disabled: true},
            {name: 'category', display: '类别', width: 150, disabled: true,editable:true, type: 'select', option: {
                'A1': '游戏', 'A2' : '电影', 'A3' : '音乐'
            }}
        ];
        var rows = [
            {"id": "001", "name": "Eclair11111111111111111111111111111111111111",   "price": "$0.87", "category": "A1", "selected": "false"},
            {"id": "002", "name": "YuJun",    "price": "$0.57", "category": "A2", "selected": "false"},
            {"id": "003", "name": "YingYing", "price": "$1.11", "category": "A3", "selected": "true"},
            {"id": "004", "name": "HaHa",     "price": "$0.89", "category": "A2", "selected": "false"},
            {"id": "005", "name": "Eclair",   "price": "$0.77", "category": "A3", "selected": "false"}
        ]
        avalon.library("aoyou", {
            $ready: function () {
                avalon.log("控件已经构建完毕")
            }
        })
        require(["./component/newgrid/avalon.newgrid"], function () {
            var vm = avalon.define({
                $id: "test",
                $gropt:{
                    title_align:"left",
                    title:"NewGrid组件,适用于带有编辑功能的表格",
                    checkbox:true,
                    singleSelect:false,
                    editable:true,
                    autoLoad:true,
                    pagerbar:true,
                    limit:2,
                    //loadUrl: './td.datagrid.json',
                    //loadParam: {
                    //    "total":"5","rspcod" :"200","rspmsg":"","rows":'23'
                    //},
                    afterAjax:function(){
                        console.log(111)
                    },
                    onrowclicked:function(){
                        console.log(2222)
                    },
                    cols: cols
                    ,rows: rows
                }
            })
            avalon.scan()
        })
    </script>
</head>
<body>
<div ms-controller="test">
    <aoyou:newgrid  $id="dg" config="$gropt" >
    </aoyou:newgrid>
</div>
</body>
</html>
